<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div>倒计时：<span id="x"></span></div>
<script>
    var x = document.getElementById('x');

    function djs(){
      //  var d1 = '2017-8-28 15:30';//通过服务器获取时间，服务器莪取的时间用户修改不了
        var date1 = new Date(d1);
        var gTime1 = date1.getTime();
        console.log(gTime1)

        var date2  = new Date('2017-8-28 15:23:05')
        var gTime2 = date2.getTime();
        console.log(gTime2)

        var diffSce = Math.floor((gTime2-gTime1)/1000);
        var diffMin = Math.floor(diffSce/60);
        var diffMinSec = Math.floor(diffSce%60);
        var s = '差：'+diffMin+'分'+diffMinSec+'秒';
        x.innerHTML = s;
        if (gTime2<=gTime1){
            clearInterval(t);
            x.innerHTML = '<input type="button" value="去败家吧">'
        }
    }
    var t  = setInterval(djs,1000);

   // console.log('差：'+diffMin+'分'+diffMinSec+'秒');
</script>
</body>
</html>